(function(undefined){
    var msg_obj = {};   
    
    /**
    * 用户给用户发私信 检查
    */
    msg_obj.send_msg = function(){
        //得到私信的内容
        content = $('#content').val();

        if($.trim(content)==''){
            dialog.finish({
                content:'内容不能为空',
                success:false
            });    
            return;
        }
        $("#sbtn").attr('disabled','');
        //用ajax提交数据
        $.post('/handle.php',$('#form1').serializeArray(),function(data){
            data = common_fun_obj.str_to_json(data);
            if(data == undefined || !data.state){
                dialog.finish({
                    content:data.msg,
                    success:false
                });
                $("#sbtn").attr('disabled','');
                return;
            }
            //完成发布后 成功
            dialog.finish({
                content:data.msg,
                success:true,
                callback:function(){
                    parent.dialog.close('msg');                                       
                }
            }); 
        });
    }

    /**
    * 用户留言
    */
    msg_obj.add_board = function(){
         //得到私信的内容
        content = $('#content').val();

        if($.trim(content)==''){
            dialog.finish({
                content:'内容不能为空',
                success:false
            });    
            return;
        }
        $("#sbtn").attr('disabled','');
        //用ajax提交数据
        $.post('/handle.php',$('#form1').serializeArray(),function(data){
            data = common_fun_obj.str_to_json(data);
            if(data == undefined || !data.state){
                dialog.finish({
                    content:data.msg,
                    success:false
                });
                $("#sbtn").attr('disabled','');

                return;
            }
            //完成发布后 成功
            dialog.finish({
                content:data.msg,
                success:true,
                callback:function(){
                    parent.dialog.close('board');                                       
                }
            }); 
        });
    }



    if(window.msg_obj == undefined) {
        window.msg_obj = msg_obj;
    }    
})();